package zjc.bookkeeping.minepage.dAccountbookmanagement;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import zjc.bookkeeping.R;

public class MultiAccountActivity extends AppCompatActivity implements View.OnClickListener {
    public static String name;
    public static String id;
    TextView nameTv,idTv;
    ImageButton backBtn;
    ListView listView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_multi_account);
        initView();
    }

    private void initView() {
        nameTv = findViewById(R.id.multi_account_name);
        nameTv.setText(name);
        idTv = findViewById(R.id.multi_account_id);
        idTv.setText(id);
        backBtn = findViewById(R.id.multi_account_back);
        listView = findViewById(R.id.multi_account_member);

        idTv.setOnClickListener(this);
        backBtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.multi_account_id:
                ClipboardManager cm =(ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                ClipData mClipData = ClipData.newPlainText("Label", idTv.getText().toString());
                cm.setPrimaryClip(mClipData);
                Toast.makeText(MultiAccountActivity.this,"复制成功，快分享给那个人吧~",Toast.LENGTH_SHORT).show();
                break;
            case R.id.multi_account_back:
                finish();
                break;
        }
    }
}